Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
text-direction
Advanced tools
Get the text direction from an element node.
npm install text-direction
If you want to go old-school, you can fetch the script with unpkg or jsdelivr.
<script src="https://unpkg.com/text-direction"></script>
<!-- or -->
<script src="https://cdn.jsdelivr.net/npm/text-direction"></script>
<script>
console.log(textDirection());
</script>
Once installed, add it to your project with common.js or ES6 syntax :
const textDirection = require("text-direction");
// or
import textDirection from "text-direction";
Then, you can start to use it on your code :
const nodeDirection = textDirection(myNode); // With a node as argument for its specific direction
const globalDirection = textDirection(); // Without argument to target <body>
Returned value are :
Since today's web browser don't support module requirements yet, you need to use a bundler like webpack or browserify.
MIT
FAQs
Get the text direction from the browser.
The npm package text-direction receives a total of 40 weekly downloads. As such, text-direction popularity was classified as not popular.
We found that text-direction demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.